/*
 * @Descripttion: 
 * @version: 
 * @Author: xcb
 * @Date: 2022-02-10 09:55:53
 * @LastEditors: xcb
 * @LastEditTime: 2022-02-23 09:03:22
 */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path"
// https://vitejs.dev/config/
export default defineConfig({
  css: {
    loaderOptions: {
      postcss: {
        plugins: [
          require('postcss-pxtorem')({ // 把px单位换算成rem单位
            rootValue: 37.5, // vant官方使用的是37.5
            selectorBlackList: ['vant', 'mu'], // 忽略转换正则匹配项
            propList: ['*']
          })
        ]
      }
    }
  },
  publicDir:"public",
  plugins: [vue()],
  // 强制预构建插件包
  optimizeDeps: {
    include: ['axios',"jquery"]
  },
  resolve:{
    alias:[
      {
        find:"@",
        replacement:path.resolve(__dirname,"src")
      }
    ]
  },
  server:{
    // open:true,
    // host:'0.0.0.0',
    // port:5000,
    // strictPort:false,
    // force: true,
    // proxy:{
    //   '/video': 'http://localhost:8080/'
    // }
    hostname: '0.0.0.0',
    port: 9090,
    proxy: {
        '/api': {
            target: 'http://192.168.3.15:7071',
            changeOrigin: true,
            rewrite: path => path.replace(/^\/api/, '')
        },
        '/app': {
          target: 'http://192.168.3.19:5044/',
          changeOrigin: true,
          rewrite: path => path.replace(/^\/app/, '')
      }
    }
  }
})
